#include <bits/stdc++.h>
using namespace std;


void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<int> dp(n);
    dp[n - 1] = 1;
    auto get = [&](int p)->int {
        if(p > n)
            return n + 1;
        else if(n == p)
            return 0;
        else return dp[p];
    };
    for(int i = n - 2; i >= 0; i--){
        dp[i] = min(dp[i + 1] + 1, get(i + a[i] + 1));
    }
    cout << dp[0] << endl;
}

int main(){
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}